package lesson.c6.mediator;

public class Mediator {
	private Gasoline gasoline;
	
	private Oil oil;
	
	public Mediator(Gasoline a , Oil b){
		gasoline = a;
		oil = b;
	}
	
	public void GasolineAffectOil(){
		float change = gasoline.getChange();
		int production = (int) (oil.getProduction() * ( 1 - change));
		oil.setProduction(production);
	}
	
	public void OilAffectGasoline(){
		float change = oil.getChange();
		float price =  gasoline.getPrice() * ( 1 - change);
		gasoline.setPrice(price);
	}
	
}
